package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.basic.mapper.BaseInStoreDetailMapper;
import com.kaili.basic.mapper.BaseMoveStoreDetailMapper;
import com.kaili.basic.pojo.dto.BaseInStoreDetailAddDto;
import com.kaili.basic.pojo.dto.BaseMoveStoreDetailAddDto;
import com.kaili.basic.pojo.entity.BaseInStoreDetailEntity;
import com.kaili.basic.pojo.entity.BaseMoveStoreDetailEntity;
import com.kaili.basic.pojo.vo.BaseInStoreDetailVO;
import com.kaili.basic.service.BaseInStoreDetailService;
import com.kaili.basic.service.BaseMoveStoreDetailService;
import com.kaili.common.util.LoginDetailUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class BaseMoveStoreDetailServiceImpl extends ServiceImpl<BaseMoveStoreDetailMapper, BaseMoveStoreDetailEntity> implements BaseMoveStoreDetailService {

    @Override
    public void insertBatch(List<BaseMoveStoreDetailAddDto> list, String orderNo) {
        List<BaseMoveStoreDetailEntity> detailList=new ArrayList<>();
        for(BaseMoveStoreDetailAddDto detailAdd:list){
            BaseMoveStoreDetailEntity detailEntity=new BaseMoveStoreDetailEntity();
            BeanUtils.copyProperties(detailAdd,detailEntity);
            detailEntity.setOrderNo(orderNo);
            detailEntity.setCreateTime(new Date());
            detailEntity.setCreateBy(LoginDetailUtils.getCurrentEmployeeId().longValue());
            detailList.add(detailEntity);
        }
        this.insertBatch(detailList);
    }
}
